
#pragma once

#include <IImage.h>
using namespace irr;
using namespace video;

namespace Irrlicht
{
	namespace Net
	{
		namespace Video
		{
			public ref class Image : public ReferenceCounted
			{
			internal:
				IImage* insider;

			public:
				Image(IImage* img) : ReferenceCounted(img)
				{
					insider = img;
				}

				void Lock()
				{
					insider->lock();
				}
				void UnLock()
				{
					insider->unlock();
				}

				
				property unsigned int BitsPerPixel
				{
					unsigned int get()
					{
						return insider->getBitsPerPixel();
					}
				}
				property unsigned int BytesPerPixel
				{
					unsigned int get()
					{
						return insider->getBytesPerPixel();
					}
				}
				property unsigned int ImageDataSizeInBytes
				{
					unsigned int get()
					{
						return insider->getImageDataSizeInBytes();
					}
				}
				property unsigned int ImageDataSizeInPixels
				{
					unsigned int get()
					{
						return insider->getImageDataSizeInPixels();
					}
				}


				property Video::ColorFormat ColorFormat
				{
					Video::ColorFormat get()
					{
						return (Video::ColorFormat)insider->getColorFormat();
					}
				}

				
				property unsigned int RedMask
				{
					unsigned int get()
					{
						return insider->getRedMask();
					}
				}
				property unsigned int GreenMask
				{
					unsigned int get()
					{
						return insider->getGreenMask();
					}
				}
				property unsigned int BlueMask
				{
					unsigned int get()
					{
						return insider->getBlueMask();
					}
				}
				property unsigned int AlphaMask
				{
					unsigned int get()
					{
						return insider->getAlphaMask();
					}
				}
				property unsigned int Pitch
				{
					unsigned int get()
					{
						return insider->getPitch();
					}
				}

				void CopyToScaling(void* target, unsigned int width, unsigned int height, Video::ColorFormat format, unsigned int pitch)
				{
					insider->copyToScaling(target, width, height, (ECOLOR_FORMAT)format, pitch);
				}
				void CopyToScaling(Image^% target)
				{
					insider->copyToScaling(target->insider);
				}
				
				void CopyToScalingBoxFilter(Image^% target, int bias, bool blend)
				{
					insider->copyToScalingBoxFilter(target->insider, bias, blend);
				}

				static unsigned int BitsPerPixelFromFormat(Video::ColorFormat format)
				{
					return IImage::getBitsPerPixelFromFormat((ECOLOR_FORMAT)format);
				}
				static bool IsRenderTargetOnlyFormat(Video::ColorFormat format)
				{
					return IImage::isRenderTargetOnlyFormat((ECOLOR_FORMAT)format);
				}
			};
		}
	}
}